
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>Introduction to atomman: Dislocation solution and generator &#8212; atomman 1.4.0 documentation</title>
    <link rel="stylesheet" href="../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Introduction to atomman: Gamma surface plotting" href="4.5._Gamma_surface_plotting.html" />
    <link rel="prev" title="Introduction to atomman: Stacking fault generator" href="4.3._Stacking_fault_generator.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="4.5._Gamma_surface_plotting.html" title="Introduction to atomman: Gamma surface plotting"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="4.3._Stacking_fault_generator.html" title="Introduction to atomman: Stacking fault generator"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">atomman 1.4.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Tutorials</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  
<style>
/* CSS for nbsphinx extension */

/* remove conflicting styling from Sphinx themes */
div.nbinput.container div.prompt *,
div.nboutput.container div.prompt *,
div.nbinput.container div.input_area pre,
div.nboutput.container div.output_area pre,
div.nbinput.container div.input_area .highlight,
div.nboutput.container div.output_area .highlight {
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

div.nbinput.container > div[class*=highlight],
div.nboutput.container > div[class*=highlight] {
    margin: 0;
}

div.nbinput.container div.prompt *,
div.nboutput.container div.prompt * {
    background: none;
}

div.nboutput.container div.output_area .highlight,
div.nboutput.container div.output_area pre {
    background: unset;
}

div.nboutput.container div.output_area div.highlight {
    color: unset;  /* override Pygments text color */
}

/* avoid gaps between output lines */
div.nboutput.container div[class*=highlight] pre {
    line-height: normal;
}

/* input/output containers */
div.nbinput.container,
div.nboutput.container {
    display: -webkit-flex;
    display: flex;
    align-items: flex-start;
    margin: 0;
    width: 100%;
}
@media (max-width: 540px) {
    div.nbinput.container,
    div.nboutput.container {
        flex-direction: column;
    }
}

/* input container */
div.nbinput.container {
    padding-top: 5px;
}

/* last container */
div.nblast.container {
    padding-bottom: 5px;
}

/* input prompt */
div.nbinput.container div.prompt pre {
    color: #307FC1;
}

/* output prompt */
div.nboutput.container div.prompt pre {
    color: #BF5B3D;
}

/* all prompts */
div.nbinput.container div.prompt,
div.nboutput.container div.prompt {
    width: 4.5ex;
    padding-top: 5px;
    position: relative;
    user-select: none;
}

div.nbinput.container div.prompt > div,
div.nboutput.container div.prompt > div {
    position: absolute;
    right: 0;
    margin-right: 0.3ex;
}

@media (max-width: 540px) {
    div.nbinput.container div.prompt,
    div.nboutput.container div.prompt {
        width: unset;
        text-align: left;
        padding: 0.4em;
    }
    div.nboutput.container div.prompt.empty {
        padding: 0;
    }

    div.nbinput.container div.prompt > div,
    div.nboutput.container div.prompt > div {
        position: unset;
    }
}

/* disable scrollbars on prompts */
div.nbinput.container div.prompt pre,
div.nboutput.container div.prompt pre {
    overflow: hidden;
}

/* input/output area */
div.nbinput.container div.input_area,
div.nboutput.container div.output_area {
    -webkit-flex: 1;
    flex: 1;
    overflow: auto;
}
@media (max-width: 540px) {
    div.nbinput.container div.input_area,
    div.nboutput.container div.output_area {
        width: 100%;
    }
}

/* input area */
div.nbinput.container div.input_area {
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    /*background: #f5f5f5;*/
}

/* override MathJax center alignment in output cells */
div.nboutput.container div[class*=MathJax] {
    text-align: left !important;
}

/* override sphinx.ext.imgmath center alignment in output cells */
div.nboutput.container div.math p {
    text-align: left;
}

/* standard error */
div.nboutput.container div.output_area.stderr {
    background: #fdd;
}

/* ANSI colors */
.ansi-black-fg { color: #3E424D; }
.ansi-black-bg { background-color: #3E424D; }
.ansi-black-intense-fg { color: #282C36; }
.ansi-black-intense-bg { background-color: #282C36; }
.ansi-red-fg { color: #E75C58; }
.ansi-red-bg { background-color: #E75C58; }
.ansi-red-intense-fg { color: #B22B31; }
.ansi-red-intense-bg { background-color: #B22B31; }
.ansi-green-fg { color: #00A250; }
.ansi-green-bg { background-color: #00A250; }
.ansi-green-intense-fg { color: #007427; }
.ansi-green-intense-bg { background-color: #007427; }
.ansi-yellow-fg { color: #DDB62B; }
.ansi-yellow-bg { background-color: #DDB62B; }
.ansi-yellow-intense-fg { color: #B27D12; }
.ansi-yellow-intense-bg { background-color: #B27D12; }
.ansi-blue-fg { color: #208FFB; }
.ansi-blue-bg { background-color: #208FFB; }
.ansi-blue-intense-fg { color: #0065CA; }
.ansi-blue-intense-bg { background-color: #0065CA; }
.ansi-magenta-fg { color: #D160C4; }
.ansi-magenta-bg { background-color: #D160C4; }
.ansi-magenta-intense-fg { color: #A03196; }
.ansi-magenta-intense-bg { background-color: #A03196; }
.ansi-cyan-fg { color: #60C6C8; }
.ansi-cyan-bg { background-color: #60C6C8; }
.ansi-cyan-intense-fg { color: #258F8F; }
.ansi-cyan-intense-bg { background-color: #258F8F; }
.ansi-white-fg { color: #C5C1B4; }
.ansi-white-bg { background-color: #C5C1B4; }
.ansi-white-intense-fg { color: #A1A6B2; }
.ansi-white-intense-bg { background-color: #A1A6B2; }

.ansi-default-inverse-fg { color: #FFFFFF; }
.ansi-default-inverse-bg { background-color: #000000; }

.ansi-bold { font-weight: bold; }
.ansi-underline { text-decoration: underline; }


div.nbinput.container div.input_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight].math,
div.nboutput.container div.output_area.rendered_html,
div.nboutput.container div.output_area > div.output_javascript,
div.nboutput.container div.output_area:not(.rendered_html) > img{
    padding: 5px;
    margin: 0;
}

/* fix copybtn overflow problem in chromium (needed for 'sphinx_copybutton') */
div.nbinput.container div.input_area > div[class^='highlight'],
div.nboutput.container div.output_area > div[class^='highlight']{
    overflow-y: hidden;
}

/* hide copybtn icon on prompts (needed for 'sphinx_copybutton') */
.prompt a.copybtn {
    display: none;
}

/* Some additional styling taken form the Jupyter notebook CSS */
div.rendered_html table {
  border: none;
  border-collapse: collapse;
  border-spacing: 0;
  color: black;
  font-size: 12px;
  table-layout: fixed;
}
div.rendered_html thead {
  border-bottom: 1px solid black;
  vertical-align: bottom;
}
div.rendered_html tr,
div.rendered_html th,
div.rendered_html td {
  text-align: right;
  vertical-align: middle;
  padding: 0.5em 0.5em;
  line-height: normal;
  white-space: normal;
  max-width: none;
  border: none;
}
div.rendered_html th {
  font-weight: bold;
}
div.rendered_html tbody tr:nth-child(odd) {
  background: #f5f5f5;
}
div.rendered_html tbody tr:hover {
  background: rgba(66, 165, 245, 0.2);
}
</style>
<div class="section" id="Introduction-to-atomman:-Dislocation-solution-and-generator">
<h1>Introduction to atomman: Dislocation solution and generator<a class="headerlink" href="#Introduction-to-atomman:-Dislocation-solution-and-generator" title="Permalink to this headline">¶</a></h1>
<p><strong>Lucas M. Hale</strong>, <a class="reference external" href="mailto:lucas&#46;hale&#37;&#52;&#48;nist&#46;gov?Subject=ipr-demo">lucas<span>&#46;</span>hale<span>&#64;</span>nist<span>&#46;</span>gov</a>, <em>Materials Science and Engineering Division, NIST</em>.</p>
<p><a class="reference external" href="http://www.nist.gov/public_affairs/disclaimer.cfm">Disclaimers</a></p>
<div class="section" id="1.-Introduction">
<h2>1. Introduction<a class="headerlink" href="#1.-Introduction" title="Permalink to this headline">¶</a></h2>
<p>This Notebook outlines the use of the classes and methods in atomman for obtaining elastic solutions for perfectly straight dislocations and constructing atomic configurations based on them.</p>
<ul class="simple">
<li><p><a class="reference external" href="#section2">Section #2</a> details the theory used to obtain the dislocation solutions and construct the atomic systems.</p></li>
<li><p><a class="reference external" href="#section3">Section #3</a> describes the VolterraDislocation classes that provide the elastic dislocation solutions and the various properties that can be obtained from them. This is useful if you want a dislocation solution but don’t want to construct an atomic configuration.</p></li>
<li><p><a class="reference external" href="#section4">Section #4</a> introduces the Dislocation class that provides a convenient means of constructing atomic configurations of dislocations.</p></li>
<li><p><a class="reference external" href="#section5">Section #5</a> shows how the Dislocation class can be used to generate dislocation monopole configurations.</p></li>
<li><p><a class="reference external" href="#section6">Section #6</a> shows how the Dislocation class can be used to generate periodic array of dislocations configurations.</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[1]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Standard Python libraries</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">datetime</span>

<span class="c1"># http://www.numpy.org/</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>

<span class="c1"># https://github.com/usnistgov/atomman</span>
<span class="kn">import</span> <span class="nn">atomman</span> <span class="k">as</span> <span class="nn">am</span>
<span class="kn">import</span> <span class="nn">atomman.unitconvert</span> <span class="k">as</span> <span class="nn">uc</span>

<span class="c1"># https://matplotlib.org/</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="o">%</span><span class="k">matplotlib</span> inline

<span class="c1"># Show atomman version</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;atomman version =&#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>

<span class="c1"># Show date of Notebook execution</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Notebook executed on&#39;</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">today</span><span class="p">())</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
atomman version = 1.4.0
Notebook executed on 2021-08-05
</pre></div></div>
</div>
</div>
<div class="section" id="2.-Theory">
<h2>2. Theory<a class="headerlink" href="#2.-Theory" title="Permalink to this headline">¶</a></h2>
<p>The Dislocation class is meant to provide a simple and convenient means of generating dislocation monopole and periodic array of dislocations atomic configurations. The dislocation configurations generated by this class contain a single dislocation which is inserted into an otherwise perfect crystalline system by applying displacements corresponding to a Volterra dislocation solution. The boundary conditions are then handled differently based on whether the system is to be a dislocation monopole
configuration or a periodic array of dislocations configuration.</p>
<div class="section" id="2.1.-Dislocation-solutions">
<h3>2.1. Dislocation solutions<a class="headerlink" href="#2.1.-Dislocation-solutions" title="Permalink to this headline">¶</a></h3>
<p>Dislocation theory is based on computing and using elasticity solutions of dislocations to define what they look like and how they interact with the surrounding material. The Volterra dislocation model assumes that the discontinuity in the crystal due to the dislocation exists as a line singularity. While this assumption does not hold true in real materials, the Volterra solution still provides a decent guess for the long-range stress and strain fields of compact dislocation cores. It also
provides a useful starting point for developing more complicated dislocation solutions, and can provide good initial guesses for constructing atomic dislocation configurations.</p>
<p>Solutions of straight dislocations are always defined relative to three orthogonal unit vectors <span class="math notranslate nohighlight">\(\hat{m}\)</span>, <span class="math notranslate nohighlight">\(\hat{n}\)</span>, and <span class="math notranslate nohighlight">\(\hat{\xi}\)</span></p>
<ul class="simple">
<li><p><span class="math notranslate nohighlight">\(\hat{m}\)</span> is the direction in the slip plane perpendicular to the dislocation’s line direction.</p></li>
<li><p><span class="math notranslate nohighlight">\(\hat{n}\)</span> is the normal of the dislocation’s slip plane.</p></li>
<li><p><span class="math notranslate nohighlight">\(\hat{\xi}\)</span> is parallel to the dislocation’s line direction.</p></li>
</ul>
<p>Based on these three vectors, we can define a Cartesian coordinate system for the dislocation solution with positions, <span class="math notranslate nohighlight">\(x_i\)</span>, given by</p>
<div class="math notranslate nohighlight">
\[x_i = x_1 \hat{m} + x_2 \hat{n} + x_3 \hat{\xi}\]</div>
<p>For straight dislocations, the elasticity solutions are independent of the <span class="math notranslate nohighlight">\(x_3\)</span> direction and therefore only depend on <span class="math notranslate nohighlight">\(x_1\)</span> and <span class="math notranslate nohighlight">\(x_2\)</span>.</p>
<div class="section" id="2.1.1.-Isotropic-solution">
<h4>2.1.1. Isotropic solution<a class="headerlink" href="#2.1.1.-Isotropic-solution" title="Permalink to this headline">¶</a></h4>
<p>For isotropic materials, the elastic solution for a Volterra dislocation can be given as analytical equations. Variations of the analytical solutions can be found in every textbook on dislocation theory. The particular equations used in atomman match those found in Elementary Dislocation Theory by Weertman and Weertman except with flipped signs. This choice provides the best correspondence of the isotropic solution to the anisotropic solutions described below.</p>
<p>Isotropic elastic constants can be represented using only two independent terms. The two isotropic elastic constants typically used for dislocation solutions are the shear modulus, <span class="math notranslate nohighlight">\(\mu\)</span>, and the Poisson’s ratio, <span class="math notranslate nohighlight">\(\nu\)</span>.</p>
<p>The isotropic displacements, <span class="math notranslate nohighlight">\(d_i\)</span>, for a dislocation centered at <span class="math notranslate nohighlight">\(x_1 = x_2 = 0\)</span> are</p>
<div class="math notranslate nohighlight">
\[u_1 = \frac{b_1}{2 \pi} \left[ \theta + \frac{x_1x_2}{2 (1 - \nu) (x_1^2 + x_2^2)} \right]\]</div>
<div class="math notranslate nohighlight">
\[u_2 = \frac{b_1}{2 \pi} \left[ -\frac{1 - 2 \nu} {4 (1 - \nu)} \ln(x_1^2 + x_2^2)
                          + \frac{y^2} {2 (1 - \nu) (x^2 + y^2)} \right]\]</div>
<div class="math notranslate nohighlight">
\[u_3 = \frac{b_3}{2 \pi} \theta.\]</div>
<p>Here (and below), <span class="math notranslate nohighlight">\(\theta\)</span> is the radial angle coordinate</p>
<div class="math notranslate nohighlight">
\[\theta=\tan^{-1} (x_2/x_1),\]</div>
<p>which is taken to range from <span class="math notranslate nohighlight">\(-\pi\)</span> to <span class="math notranslate nohighlight">\(\pi\)</span>.</p>
<p>The isotropic stress, <span class="math notranslate nohighlight">\(\sigma_{ij}\)</span>, is given by the equations</p>
<div class="math notranslate nohighlight">
\[\sigma_{11} = -\frac{\mu b_1}{2 \pi (1 - \nu)} \frac{x_2 (3 x_1^2 + x_2^2)} { (x_1^2 + x_2^2)^2}\]</div>
<div class="math notranslate nohighlight">
\[\sigma_{22} = \frac{\mu b_1}{2 \pi (1 - \nu)} \frac{x_2 (x_1^2 - x_2^2)} { (x_1^2 + x_2^2)^2}\]</div>
<div class="math notranslate nohighlight">
\[\sigma_{33} = \nu(\sigma_{11} + \sigma_{22})\]</div>
<div class="math notranslate nohighlight">
\[\sigma_{12} = \frac{\mu b_1}{2 \pi (1 - \nu)} \frac{x_1(x_1^2 - x_2^2)) }{ (x_1^2 + x_2^2)^2}\]</div>
<div class="math notranslate nohighlight">
\[\sigma_{13} =-\frac{\mu b_3}{2 \pi} \frac{x_2}{(x_1^2 + x_2^2)}\]</div>
<div class="math notranslate nohighlight">
\[\sigma_{23} = \frac{\mu b_3}{2 \pi} \frac{x_1}{(x_1^2 + x_2^2)}\]</div>
<p>The energy coefficient tensor, <span class="math notranslate nohighlight">\(K_{ij}\)</span>, depends on the elastic constants. Only normal components are non-zero for the isotropic case</p>
<div class="math notranslate nohighlight">
\[K_{11}^{iso} = K_{22}^{iso} = K_{edge}^{iso} = \frac{\mu}{1 - \nu}\]</div>
<div class="math notranslate nohighlight">
\[K_{33}^{iso} = K_{screw}^{iso} = \mu.\]</div>
<p><strong>Caution</strong>: <span class="math notranslate nohighlight">\(K_{ij}\)</span> may be defined slightly differently in other works depending on if they contain multiplicative factors. If you are comparing atomman’s values to other works, be sure to double check how <span class="math notranslate nohighlight">\(K_{ij}\)</span> and the self-energy equations below are defined.</p>
<p>The dislocation’s self-energy is the energy per unit length within a ring region around the dislocation line. It depends on <span class="math notranslate nohighlight">\(K_{ij}\)</span> and <span class="math notranslate nohighlight">\(b_i\)</span></p>
<div class="math notranslate nohighlight">
\[\frac{W}{l} = \frac{b_i K_{ij} b_j}{4 \pi} \ln{ \left( \frac{R}{r_0} \right)}.\]</div>
<p>The energy coefficient tensor can also be reduced down to a single coefficient, <span class="math notranslate nohighlight">\(K\)</span></p>
<div class="math notranslate nohighlight">
\[K = \frac{b_i K_{ij} b_j} {b_k b_k},\]</div>
<p>which the self-energy expression then becomes</p>
<div class="math notranslate nohighlight">
\[\frac{W}{l} = \frac{K b^2}{4 \pi} \ln{ \left( \frac{R}{r_0} \right)},\]</div>
<p>Alternatively, everything in the self-energy expression outside the ln term can be grouped together as the pre-ln factor</p>
<div class="math notranslate nohighlight">
\[\frac{W}{l} = a \ln{ \left( \frac{R}{r_0} \right)}.\]</div>
</div>
<div class="section" id="2.1.2.-Anisotropic-solution">
<h4>2.1.2. Anisotropic solution<a class="headerlink" href="#2.1.2.-Anisotropic-solution" title="Permalink to this headline">¶</a></h4>
<p>The elasticity solution for Volterra dislocations in anisotropic materials was first introduced by <a class="reference external" href="https://doi.org/10.1016/0001-6160(53)90099-6">Eshelby</a>. Starting with the fundamental equations of elasticity</p>
<div class="math notranslate nohighlight">
\[\sigma_{ij} = C_{ijkl} \epsilon_{kl}\]</div>
<div class="math notranslate nohighlight">
\[\epsilon_{ij} = \frac{1}{2} \left(\frac{\partial u_i}{\partial x_j} + \frac{\partial u_j}{\partial x_i}\right)\]</div>
<div class="math notranslate nohighlight">
\[\frac{\partial \sigma_{ij}}{\partial x_j} = 0\]</div>
<p>Combining these and taking the solution to be independent of <span class="math notranslate nohighlight">\(x_3\)</span> generates the partial differential equation</p>
<div class="math notranslate nohighlight">
\[C_{ijkl} \frac{ \partial^2 u_k}{\partial x_j \partial x_l} = 0\]</div>
<p>Solutions of the partial differential equation are of the form</p>
<div class="math notranslate nohighlight">
\[u_k = A_k f(x_1 + p x_2)\]</div>
<p>Values of <span class="math notranslate nohighlight">\(A_k\)</span> and <span class="math notranslate nohighlight">\(p\)</span> can be found by solving</p>
<div class="math notranslate nohighlight">
\[\left[C_{i1k1} + \left(C_{i1k2} + C_{i2k1} \right) p + C_{i2k2} p^2 \right] A_k = 0\]</div>
<p>The determinate expression is a sixth-order polynomial expression resulting in six complex roots, <span class="math notranslate nohighlight">\(p_\alpha\)</span> with <span class="math notranslate nohighlight">\(\alpha\)</span> ranging 1 to 6. There is also one <span class="math notranslate nohighlight">\(A_{k \alpha}\)</span> corresponding to each root.</p>
<p>Later, <a class="reference external" href="https://doi.org/10.1080/14786435808565804">Stroh</a> introduced a method for easily solving for the six roots. Another vector, <span class="math notranslate nohighlight">\(L_i\)</span> is defined for each <span class="math notranslate nohighlight">\(\alpha\)</span> root as</p>
<div class="math notranslate nohighlight">
\[L_{i \alpha} = \left(C_{i2k1} + p_{\alpha} C_{i2k2} \right) A_{k \alpha}\]</div>
<p>and a normalization factor, <span class="math notranslate nohighlight">\(k_{\alpha}\)</span>, is introduced as</p>
<div class="math notranslate nohighlight">
\[k_{\alpha} = \frac{1}{2 A_{j \alpha} L_{j \alpha}}\]</div>
<p>Stroh’s method then expresses the problem as an eigenvector problem in which the eigenvalues give <span class="math notranslate nohighlight">\(p_{\alpha}\)</span> and the eigenvectors give <span class="math notranslate nohighlight">\(A_{i \alpha}\)</span> and <span class="math notranslate nohighlight">\(L_{i \alpha}\)</span>. Properties of the dislocation can then be computed using these solution parameters</p>
<div class="math notranslate nohighlight">
\[u_j = \frac{1}{2 \pi i} \sum_{\alpha}  \pm k_{\alpha} A_{j \alpha} (L_{l \alpha} b_l) \ln{\eta_{\alpha}}\]</div>
<div class="math notranslate nohighlight">
\[\sigma_{ij} = \frac{1}{2 \pi i} \sum_{\alpha}  \pm k_{\alpha} C_{ijkl}[m_l + p_{\alpha} n_l] A_{k \alpha} (L_{m \alpha} b_m) \frac{1}{\eta_{\alpha}}\]</div>
<div class="math notranslate nohighlight">
\[K_{jl} = i \sum_{\alpha} \pm k_{\alpha} L_{j \alpha} L_{l \alpha}\]</div>
<p>For the displacement and stress equations, <span class="math notranslate nohighlight">\(\eta\)</span> is an imaginary coordinate that combines <span class="math notranslate nohighlight">\(x_1\)</span> and <span class="math notranslate nohighlight">\(x_2\)</span> using the computed eigenvalues <span class="math notranslate nohighlight">\(p_{\alpha}\)</span></p>
<div class="math notranslate nohighlight">
\[\eta_{\alpha} = x_1 + p_{\alpha} x_2\]</div>
</div>
<div class="section" id="2.1.3.-Linear-displacement-solution">
<h4>2.1.3. Linear displacement solution<a class="headerlink" href="#2.1.3.-Linear-displacement-solution" title="Permalink to this headline">¶</a></h4>
<p>The periodic array of dislocations configuration uses an additional solution based on applying a linear gradient of displacements to the atoms to generate a geometrically necessary dislocation inside the system.</p>
<div class="math notranslate nohighlight">
\[u_j = \frac{b_j}{2} - \text{sign}(x_2)\left[ \frac{x_1 b_j}{2l} + \frac{b_j}{4}\right],\]</div>
<p>where <span class="math notranslate nohighlight">\(l\)</span> is the full periodic length of the system in the <span class="math notranslate nohighlight">\(\hat{m}\)</span> direction. By applying opposite displacements above and below the slip plane, the atomic disregistry linearly varies from 0 to <span class="math notranslate nohighlight">\(b\)</span> across the system.</p>
<p>While this does not give a good approximation of a real dislocation, it does have a couple of benefits besides its simplicity. First, the solution is independent of the dislocation’s position along the slip plane. This makes it a good choice of displacements for the non-periodic surfaces if the atoms are held rigidly as the interaction between the dislocation and the boundaries will remain constant as the dislocation moves. Also, since <span class="math notranslate nohighlight">\(u_j\)</span> depends on <span class="math notranslate nohighlight">\(\text{sign}(x_2)\)</span> rather than
<span class="math notranslate nohighlight">\(x_2\)</span> the solution on each side of the slip plane only depends on <span class="math notranslate nohighlight">\(x_1\)</span>.</p>
</div>
</div>
<div class="section" id="2.2.-Dislocation-definition">
<h3>2.2. Dislocation definition<a class="headerlink" href="#2.2.-Dislocation-definition" title="Permalink to this headline">¶</a></h3>
<p>A type of dislocation can be fully defined relative to a unit cell, ucell, by specifying the Miller slip plane, <span class="math notranslate nohighlight">\(n_{(hkl)}\)</span>, the Miller Burgers vector, <span class="math notranslate nohighlight">\(b_{[uvw]}\)</span>, and the Miller line direction, <span class="math notranslate nohighlight">\(\xi_{[uvw]}\)</span>. Defining dislocations using Miller planes and vectors rather than Cartesian planes and vectors is more convenient as the definitions hold true for all crystals associated with a given crystal prototype. This is also how dislocations are typically defined by materials
scientists.</p>
<p>The dislocation’s character (screw, edge, mixed) is given by the angle between <span class="math notranslate nohighlight">\(b_{[uvw]}\)</span> and <span class="math notranslate nohighlight">\(\xi_{[uvw]}\)</span>. Screw dislocations have <span class="math notranslate nohighlight">\(\xi_{[uvw]}\)</span> parallel to <span class="math notranslate nohighlight">\(b_{[uvw]}\)</span>, and therefore a character angle of 0<span class="math notranslate nohighlight">\(^{\circ}\)</span> or 180<span class="math notranslate nohighlight">\(^{\circ}\)</span>, while edge dislocations have the two directions perpendicular for a character angle of 90<span class="math notranslate nohighlight">\(^{\circ}\)</span>. For atomic configurations, the line direction must be a crystal vector, which limits the character angles that
can be explored. This is done as the system is periodic along the line direction vector and atomic compatibility is only possible if the direction is a lattice vector or a multiple of one.</p>
<p>The orientation of the dislocation solution with respect to the final atomic configuration is handled by specifying the dislocation solution axes <span class="math notranslate nohighlight">\(\hat{m}\)</span> and <span class="math notranslate nohighlight">\(\hat{n}\)</span> as Cartesian unit vectors. For simplicity, the Dislocation class restricts <span class="math notranslate nohighlight">\(\hat{m}\)</span>, <span class="math notranslate nohighlight">\(\hat{n}\)</span>, and <span class="math notranslate nohighlight">\(\hat{\xi} = \hat{m} \times \hat{n}\)</span> to each be aligned with one of the three Cartesian axes of the atomic configuration.</p>
<p>The slip plane normal relative to the unit cell, <span class="math notranslate nohighlight">\(n_{ucell}\)</span>, is identified by converting <span class="math notranslate nohighlight">\(n_{(hkl)}\)</span> into Cartesian units. Using <span class="math notranslate nohighlight">\(n_{ucell}\)</span>, three Miller crystal vectors are identified that determine how to rotate the unit cell</p>
<ul class="simple">
<li><p><span class="math notranslate nohighlight">\(\xi_{[uvw]}\)</span>.</p></li>
<li><p>An in-plane vector with <span class="math notranslate nohighlight">\(|u|,|v|,|w|\)</span> values less than some maximum that is closest to perpendicular to <span class="math notranslate nohighlight">\(\xi_{[uvw]}\)</span>.</p></li>
<li><p>An out-of-plane vector with <span class="math notranslate nohighlight">\(|u|,|v|,|w|\)</span> values less than some maximum that is closest to being parallel to <span class="math notranslate nohighlight">\(n_{ucell}\)</span>.</p></li>
</ul>
<p>These three vectors are used as the box rotation vectors, <span class="math notranslate nohighlight">\(a_{[uvw]}\)</span>, <span class="math notranslate nohighlight">\(b_{[uvw]}\)</span>, and <span class="math notranslate nohighlight">\(c_{[uvw]}\)</span>, for orienting the final configuration. How the identified vectors are associated with the rotation vectors depends on the Cartesian axes that <span class="math notranslate nohighlight">\(\hat{m}\)</span>, <span class="math notranslate nohighlight">\(\hat{n}\)</span> and <span class="math notranslate nohighlight">\(\hat{\xi}\)</span> correspond to</p>
<ul class="simple">
<li><p>In the final configuration, <span class="math notranslate nohighlight">\(a_{[uvw]}\)</span> has its primary component along the <span class="math notranslate nohighlight">\(x\)</span>-axis, <span class="math notranslate nohighlight">\(b_{[uvw]}\)</span> along the <span class="math notranslate nohighlight">\(y\)</span>-axis, and <span class="math notranslate nohighlight">\(c_{[uvw]}\)</span> along the <span class="math notranslate nohighlight">\(z\)</span>-axis.</p></li>
<li><p><span class="math notranslate nohighlight">\(\xi_{[uvw]}\)</span> is positioned along the Cartesian axis specified by <span class="math notranslate nohighlight">\(\hat{\xi}\)</span>. This alignment means that the associated rotation vector will only have a component along that Cartesian direction. For example, if <span class="math notranslate nohighlight">\(\hat{\xi}=x\)</span>, then <span class="math notranslate nohighlight">\(a_{[uvw]}\)</span> will only have an <span class="math notranslate nohighlight">\(x\)</span> component.</p></li>
<li><p>The identified out-of-plane vector will correspond to the box rotation vector with the primary component along the Cartesian axis specified by <span class="math notranslate nohighlight">\(\hat{n}\)</span>.</p></li>
<li><p>The identified in-plane vector is taken as the final box rotation vector. As this vector is necessarily normal to <span class="math notranslate nohighlight">\(\hat{n}\)</span>, it cannot have a component along the Cartesian axis associated with <span class="math notranslate nohighlight">\(\hat{n}\)</span>.</p></li>
</ul>
<p>Note that the out-of-plane vector need not be parallel to the slip plane normal. Rather, it simply needs to be the only box vector with a component in the <span class="math notranslate nohighlight">\(\hat{n}\)</span> direction. This is because the slip plane is defined by the cross product of <span class="math notranslate nohighlight">\(\xi_{[uvw]}\)</span> and the identified in-plane vector, not the out-of-plane vector.</p>
<p>A rotated cell, rcell, is then created using ucell and the rotation vectors. This rotated cell serves as the seed for constructing the larger atomic configurations in which the dislocation is inserted. As rcell is constructed, the Cartesian transformation matrix, <span class="math notranslate nohighlight">\(T\)</span>, associated with transforming from the ucell orientation to the rcell orientation is also identified. The unit cell and <span class="math notranslate nohighlight">\(T\)</span> are then used to convert <span class="math notranslate nohighlight">\(b_{[uvw]}\)</span> to the Cartesian <span class="math notranslate nohighlight">\(b\)</span> vector.</p>
<p>Finally, a rigid body shift, <span class="math notranslate nohighlight">\(\delta\)</span> is defined relative to rcell. This is used to adjust the atomic positions such that the mathematical position of the dislocation line and/or slip plane can be properly placed relative to the atoms. For dislocations defined relative to crystal prototypes, <span class="math notranslate nohighlight">\(\delta\)</span> can be expressed in reduced coordinates relative to ucell. Alternatively, rcell itself can be used to identify shifts normal to the slip plane that place the mathematical slip plane
halfway between all atomic planes in rcell. This allows for dislocations to be easily generated either from pre-defined parameters or based on optimum shift recommendations.</p>
</div>
<div class="section" id="2.3.-Boundary-conditions">
<h3>2.3. Boundary conditions<a class="headerlink" href="#2.3.-Boundary-conditions" title="Permalink to this headline">¶</a></h3>
<div class="section" id="2.3.1.-Dislocation-monopoles">
<h4>2.3.1. Dislocation monopoles<a class="headerlink" href="#2.3.1.-Dislocation-monopoles" title="Permalink to this headline">¶</a></h4>
<p>A dislocation monopole is an atomic configuration that contains a single straight dislocation.</p>
<ul class="simple">
<li><p>The box direction parallel to the dislocation line is made periodic. The other two box directions are non-periodic.</p></li>
<li><p>A boundary region is defined that encompasses the atoms near the non-periodic boundaries. This region is identified by changing the atype values of the atoms in those geometric regions.</p></li>
</ul>
<p>The Dislocation class constructs the atomic configurations but leaves it up to users to define how to relax the system. Typically, the atoms in the boundary region are held fixed while the remaining atoms near the core are relaxed using molecular dynamics steps and/or an energy or force minimization. Relaxations can either be rigid boundary relaxations or flexible boundary relaxations depending on if the boundary atoms are adjusted during the relaxation process.</p>
<p>A rigid boundary relaxation is one in which the boundary atoms are never adjusted after the initial system construction. As the atoms are held at a dislocation solution, the initial positions tend to be a decent guess for dislocations with compact cores. However, a misfit force will arise at the interface between the boundary and non-boundary atoms that can influence the dislocation structure, energies and behavior. The influence of the misfit force can be minimized by constructing large atomic
configurations and keeping investigations to dislocations with compact cores that remain positioned near the center of the systems.</p>
<p>A flexible boundary relaxation is one in which the boundary atoms are subjected to an alternative relaxation method, such as the lattice Greens function. This alternative relaxation method allows for the misfit forces at the interface between the boundary and non-boundary atoms to be reduced while preventing the atoms at the non-periodic box boundaries from forming free surfaces. This method is preferred for expensive atomistic methods like DFT as it gives good structure predictions as long as
the dislocation core itself remains in the non-boundary region.</p>
</div>
<div class="section" id="2.3.2.-Periodic-array-of-dislocations">
<h4>2.3.2. Periodic array of dislocations<a class="headerlink" href="#2.3.2.-Periodic-array-of-dislocations" title="Permalink to this headline">¶</a></h4>
<p>A periodic array of dislocations atomic configuration is one in which the system itself only contains one dislocation, but the system’s box boundary conditions are such that it represents an infinite array of equally spaced dislocations.</p>
<ul class="simple">
<li><p>The two box directions in the slip plane are made periodic while the out-of-plane box direction is non-periodic.</p></li>
<li><p>The box dimensions are modified to ensure that the atoms remain compatible and coherent across the two periodic box directions.</p></li>
<li><p>For dislocations with edge components, the atomic compatibility requires that a half-plane of atoms either be inserted or deleted. This is handled here by shrinking the box dimensions and identifying the half-plane of atoms to delete as those that have nearly identical positions with other atoms in the shrunken system.</p></li>
<li><p>A boundary region is identified at the non-periodic surface. The atoms in the boundary region are identified by changing their atype values, and are given coordinates that correspond to the global linear displacements rather than the local dislocation displacements.</p></li>
</ul>
<p>The choice of displacing the atoms in the boundary region by a linear gradient of displacements rather than the dislocation solution displacements is done as the linear gradient is independent of the dislocation’s position. There will be misfit forces at the interface between the boundary and non-boundary regions, but those forces will be (mostly) independent of the dislocation’s position in the system. The slip behavior of dislocations can therefore be studied by applying shear strains/stresses
to the system by adding displacements/forces to the boundary atoms. Some examples:</p>
<ul class="simple">
<li><p>Quasistatic calculations in which energy/force relaxations are used after incremental displacements of the boundaries. This can be used to estimate the Peierls barrier, with good estimates requiring very small force relaxation tolerances and very small displacements at each iteration.</p></li>
<li><p>Strain-controlled simulations in which a constant displacement rate is applied to the boundary atoms. Simulations can either have rigid boundaries, in which the boundary atoms only move in the displacement direction, or free-surface boundaries, in which motion in the displacement direction is fixed but MD motions in perpendicular directions are allowed.</p></li>
<li><p>Stress-controlled simulations in which a constant force is applied to the boundary atoms. Simulations can either have rigid boundaries, in which the boundary is treated as a rigid block that the force acts on, or free-surface boundaries, in which the boundary atoms are subjected to MD steps but each has an extra constant force applied to it.</p></li>
</ul>
</div>
</div>
</div>
<div class="section" id="3.-Volterra-solutions">
<h2>3. Volterra solutions<a class="headerlink" href="#3.-Volterra-solutions" title="Permalink to this headline">¶</a></h2>
<p><strong>Skip to</strong><a class="reference external" href="#section4">Section #4</a><strong>if you want to construct atomic configurations!</strong></p>
<p>A Volterra dislocation solution can be obtained with the solve_volterra_dislocation() function.</p>
<p><em>Update Version 1.3.2: ξ_uvw, slip_hkl, and box parameters added to make defining systems easier, especially for non-cubic crystals. axes renamed to transform for clarity.</em></p>
<p>Parameters</p>
<ul class="simple">
<li><p><strong>C</strong> (<em>atomman.ElasticConstants</em>) The medium’s elastic constants.</p></li>
<li><p><strong>burgers</strong> (<em>array-like object</em>) The dislocation’s Burgers vector.</p></li>
<li><p><strong>ξ_uvw</strong> (<em>array-like object</em>) The Miller crystal vector associated with the dislocation’s line direction. Must be given with slip_hkl to identify the transformation matrix to use on C and burgers.</p></li>
<li><p><strong>slip_hkl</strong> (<em>array-like object</em>) The Miller plane indices associated with the dislocation’s slip plane. Must be given with slip_hkl to identify the transformation matrix to use on C and burgers.</p></li>
<li><p><strong>transform</strong> (<em>array-like object, optional</em>) A 3x3 set of orthogonal Cartesian vectors that define the transformation matrix to use on C and burgers to convert from the standard (unit cell) and dislocation orientations. The 3 vectors will automatically be converted into unit vectors. Using this is an alternative to using ξ_uvw and slip_hkl.</p></li>
<li><p><strong>axes</strong> (<em>array-like object, optional</em>) Same as transform. Retained for backwards compatibility.</p></li>
<li><p><strong>box</strong> (<em>atomman.Box, optional</em>) The unit cell’s box that crystal vectors are taken with respect to. If not given, will use a cubic box with a=1 meaning that burgers, ξ_uvw and slip_hkl will be interpreted as Cartesian vectors.</p></li>
<li><p><strong>m</strong> (<em>array-like object, optional</em>) The m Cartesian unit vector for the solution giving the <span class="math notranslate nohighlight">\(x_1\)</span> direction. m, n, and <span class="math notranslate nohighlight">\(\xi\)</span> (dislocation line direction) should be right-hand orthogonal. Default value is [1,0,0] (Cartesian x-axis).</p></li>
<li><p><strong>n</strong> (<em>array-like object, optional</em>) The n Cartesian unit vector for the solution giving the <span class="math notranslate nohighlight">\(x_2\)</span> direction. m, n, and <span class="math notranslate nohighlight">\(\xi\)</span> (dislocation line direction) should be right-hand orthogonal. Default value is [0,1,0] (Cartesian y-axis).</p></li>
<li><p><strong>tol</strong> (<em>float</em>) Tolerance parameter used to round off near-zero values. Default value is 1e-8.</p></li>
</ul>
<p>Returns</p>
<ul class="simple">
<li><p>(<em>atomman.defect.VolterraDislocation</em>) The dislocation solution. This will be an atomman.defect.IsotropicVolterraDislocation object or an atomman.defect.Stroh object depending on if the elastic constants used are isotropic or anisotropic.</p></li>
</ul>
<div class="section" id="3.1.-Build-solution">
<h3>3.1. Build solution<a class="headerlink" href="#3.1.-Build-solution" title="Permalink to this headline">¶</a></h3>
<p>Specify materials properties, namely the unit cell box and the elastic constants.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[2]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Rough values for fcc Cu</span>

<span class="c1"># Build box</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">3.6</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">box</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">Box</span><span class="o">.</span><span class="n">cubic</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">)</span>

<span class="c1"># Isotropic Cij values</span>
<span class="c1">#E = uc.set_in_units(130, &#39;GPa&#39;)</span>
<span class="c1">#Poisson = 0.34</span>
<span class="c1">#C = am.ElasticConstants(E=E, nu=Poisson)</span>

<span class="c1"># Anisotropic values for Cu</span>
<span class="n">C11</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mi">169</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">)</span>
<span class="n">C12</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mi">122</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">)</span>
<span class="n">C44</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">75.4</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">)</span>
<span class="n">C</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">ElasticConstants</span><span class="p">(</span><span class="n">C11</span><span class="o">=</span><span class="n">C11</span><span class="p">,</span> <span class="n">C12</span><span class="o">=</span><span class="n">C12</span><span class="p">,</span> <span class="n">C44</span><span class="o">=</span><span class="n">C44</span><span class="p">)</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Cij in GPa:&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">C</span><span class="o">.</span><span class="n">Cij</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Cij in GPa:
[[169.  122.  122.    0.    0.    0. ]
 [122.  169.  122.    0.    0.    0. ]
 [122.  122.  169.    0.    0.    0. ]
 [  0.    0.    0.   75.4   0.    0. ]
 [  0.    0.    0.    0.   75.4   0. ]
 [  0.    0.    0.    0.    0.   75.4]]
</pre></div></div>
</div>
<p>Specify the dislocation type. Using box (above) allows for these values to be given as Miller crystal vectors.</p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[3]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># fcc a/2[1 0 -1](1 1 1)</span>
<span class="n">burgers</span> <span class="o">=</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">])</span>
<span class="n">slip_hkl</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>

<span class="c1"># The dislocation&#39;s line direction (ξ_uvw) determines character</span>
<span class="n">ξ_uvw</span> <span class="o">=</span> <span class="p">[</span> <span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span> <span class="c1"># 90 degree edge</span>
<span class="c1">#ξ_uvw = [1, -1, 0] # 60 degree mixed</span>
<span class="c1">#ξ_uvw = [1, 1, -2] # 30 degree mixed</span>
<span class="c1">#ξ_uvw = [1, 0, -1] # 0 degree screw, i.e. parallel to burgers</span>
</pre></div>
</div>
</div>
<p>Specify the orientation for the solution.</p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[4]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">m</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span> <span class="c1"># align edge component with the x-axis</span>
<span class="n">n</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span> <span class="c1"># align slip plane normal with the y-axis</span>
</pre></div>
</div>
</div>
<p>Create the solution</p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[5]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">solution</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">defect</span><span class="o">.</span><span class="n">solve_volterra_dislocation</span><span class="p">(</span><span class="n">C</span><span class="p">,</span> <span class="n">burgers</span><span class="p">,</span> <span class="n">ξ_uvw</span><span class="o">=</span><span class="n">ξ_uvw</span><span class="p">,</span> <span class="n">slip_hkl</span><span class="o">=</span><span class="n">slip_hkl</span><span class="p">,</span> <span class="n">box</span><span class="o">=</span><span class="n">box</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="n">m</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="n">n</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="3.2.-Compute-properties">
<h4>3.2. Compute properties<a class="headerlink" href="#3.2.-Compute-properties" title="Permalink to this headline">¶</a></h4>
<p>Check configuration</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[6]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Dislocation configuration:&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;m:        &#39;</span><span class="p">,</span> <span class="n">solution</span><span class="o">.</span><span class="n">m</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;n:        &#39;</span><span class="p">,</span> <span class="n">solution</span><span class="o">.</span><span class="n">n</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;ξ:        &#39;</span><span class="p">,</span> <span class="n">solution</span><span class="o">.</span><span class="n">ξ</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Burgers:  &#39;</span><span class="p">,</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">burgers</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">),</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;|Burgers|:&#39;</span><span class="p">,</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">burgers</span><span class="p">),</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">),</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Character:&#39;</span><span class="p">,</span> <span class="n">solution</span><span class="o">.</span><span class="n">characterangle</span><span class="p">(),</span> <span class="s1">&#39;degrees&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Transformation matrix from standard orientation to dislocation orientation:&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">transform</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Dislocation configuration:
m:         [1. 0. 0.]
n:         [0. 1. 0.]
ξ:         [0. 0. 1.]
Burgers:   [2.54558441 0.         0.        ] angstrom
|Burgers|: 2.545584412271571 angstrom
Character: 90.0 degrees

Transformation matrix from standard orientation to dislocation orientation:
[[ 0.70710678  0.         -0.70710678]
 [ 0.57735027  0.57735027  0.57735027]
 [ 0.40824829 -0.81649658  0.40824829]]
</pre></div></div>
</div>
<p>View solution parameters</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[7]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">solution</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">defect</span><span class="o">.</span><span class="n">IsotropicVolterraDislocation</span><span class="p">):</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Solution is isotropic&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;mu -&gt; {uc.get_in_units(solution.mu, &quot;GPa&quot;):.3f} GPa&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;nu -&gt; </span><span class="si">{solution.nu:.3f}</span><span class="s1">&#39;</span><span class="p">)</span>

<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">solution</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">defect</span><span class="o">.</span><span class="n">Stroh</span><span class="p">):</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Solution is anisotropic&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;p -&gt;&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">p</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;A -&gt;&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">A</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;L -&gt;&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">L</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;k -&gt;&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">k</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Solution is anisotropic
p -&gt;
[ 0.57432511+1.48063821j  0.57432511-1.48063821j -0.57432511+1.48063821j
 -0.57432511-1.48063821j  0.        +0.39392852j  0.        -0.39392852j]
A -&gt;
[[ 4.92478068e-01+2.92695902e-01j -1.86741173e-01+9.77580274e-02j
   6.67206634e-01+0.00000000e+00j]
 [ 4.92478068e-01-2.92695902e-01j -1.86741173e-01-9.77580274e-02j
   6.67206634e-01-0.00000000e+00j]
 [-4.92478068e-01+2.92695902e-01j -1.86741173e-01-9.77580274e-02j
   6.67206634e-01+0.00000000e+00j]
 [-4.92478068e-01-2.92695902e-01j -1.86741173e-01+9.77580274e-02j
   6.67206634e-01-0.00000000e+00j]
 [-3.81543382e-17-1.47294255e-01j  7.89087414e-01+0.00000000e+00j
   4.27766816e-01-8.60735226e-17j]
 [-3.81543382e-17+1.47294255e-01j  7.89087414e-01-0.00000000e+00j
   4.27766816e-01+8.60735226e-17j]]
L -&gt;
[[ 1.87773573e-01-2.53391120e-01j  1.05996344e-01+1.67934295e-01j
  -2.23781767e-02-2.06874267e-01j]
 [ 1.87773573e-01+2.53391120e-01j  1.05996344e-01-1.67934295e-01j
  -2.23781767e-02+2.06874267e-01j]
 [ 1.87773573e-01+2.53391120e-01j -1.05996344e-01+1.67934295e-01j
   2.23781767e-02-2.06874267e-01j]
 [ 1.87773573e-01-2.53391120e-01j -1.05996344e-01-1.67934295e-01j
   2.23781767e-02+2.06874267e-01j]
 [-1.50398047e-01-5.74605304e-18j  1.28485597e-16-3.81790193e-01j
  -8.49601677e-17-6.54039958e-02j]
 [-1.50398047e-01+5.74605304e-18j  1.28485597e-16+3.81790193e-01j
  -8.49601677e-17+6.54039958e-02j]]
k -&gt;
[ 8.78792266e-01+1.74127681j  8.78792266e-01-1.74127681j
 -8.78792266e-01+1.74127681j -8.78792266e-01-1.74127681j
  3.40946117e-16+1.62818332j  3.40946117e-16-1.62818332j]
</pre></div></div>
</div>
<p><span class="math notranslate nohighlight">\(K_{ij}\)</span>, <span class="math notranslate nohighlight">\(K\)</span>, and pre-ln factor</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[8]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="nb">print</span><span class="p">(</span><span class="s1">&#39;K_tensor (in GPa) -&gt;&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">K_tensor</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">))</span>
<span class="nb">print</span><span class="p">()</span>

<span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;K_coeff -&gt; {uc.get_in_units(solution.K_coeff, &quot;GPa&quot;):.3f} GPa&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;preln -&gt; {uc.get_in_units(solution.preln, &quot;eV/Å&quot;):f} eV/Å&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
K_tensor (in GPa) -&gt;
[[74.09648694  0.          0.        ]
 [ 0.         74.9325418  -8.62796136]
 [ 0.         -8.62796136 44.21693456]]

K_coeff -&gt; 74.096 GPa
preln -&gt; 0.238480 eV/Å
</pre></div></div>
</div>
<p>Construct a grid of points for evaluating displacement and stress</p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[9]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Generate spacial grid of points</span>
<span class="n">xy_max</span> <span class="o">=</span> <span class="mi">15</span>
<span class="n">num_xy</span> <span class="o">=</span> <span class="mi">100</span>
<span class="n">xvals</span> <span class="o">=</span> <span class="n">yvals</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="o">-</span><span class="n">xy_max</span><span class="p">,</span> <span class="n">xy_max</span><span class="p">,</span> <span class="n">num_xy</span><span class="p">)</span>
<span class="n">xvals</span><span class="p">,</span> <span class="n">yvals</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">meshgrid</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="o">-</span><span class="n">xy_max</span><span class="p">,</span> <span class="n">xy_max</span><span class="p">,</span> <span class="mi">100</span><span class="p">),</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="o">-</span><span class="n">xy_max</span><span class="p">,</span> <span class="n">xy_max</span><span class="p">,</span> <span class="n">num_xy</span><span class="p">))</span>

<span class="c1"># Convert points to coordinates relative to dislocation system</span>
<span class="n">coords</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">outer</span><span class="p">(</span><span class="n">xvals</span><span class="p">,</span> <span class="n">m</span><span class="p">)</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">outer</span><span class="p">(</span><span class="n">yvals</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>

<span class="c1"># Identify x, y directions</span>
<span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">isclose</span><span class="p">(</span><span class="n">m</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mf">1.0</span><span class="p">):</span>
    <span class="n">xlabel</span> <span class="o">=</span> <span class="s1">&#39;$x_1$&#39;</span>
<span class="k">elif</span> <span class="n">np</span><span class="o">.</span><span class="n">isclose</span><span class="p">(</span><span class="n">m</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mf">1.0</span><span class="p">):</span>
    <span class="n">xlabel</span> <span class="o">=</span> <span class="s1">&#39;$x_2$&#39;</span>
<span class="k">elif</span> <span class="n">np</span><span class="o">.</span><span class="n">isclose</span><span class="p">(</span><span class="n">m</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="mf">1.0</span><span class="p">):</span>
    <span class="n">xlabel</span> <span class="o">=</span> <span class="s1">&#39;$x_3$&#39;</span>
<span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">isclose</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mf">1.0</span><span class="p">):</span>
    <span class="n">ylabel</span> <span class="o">=</span> <span class="s1">&#39;$x_1$&#39;</span>
<span class="k">elif</span> <span class="n">np</span><span class="o">.</span><span class="n">isclose</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mf">1.0</span><span class="p">):</span>
    <span class="n">ylabel</span> <span class="o">=</span> <span class="s1">&#39;$x_2$&#39;</span>
<span class="k">elif</span> <span class="n">np</span><span class="o">.</span><span class="n">isclose</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="mf">1.0</span><span class="p">):</span>
    <span class="n">ylabel</span> <span class="o">=</span> <span class="s1">&#39;$x_3$&#39;</span>
</pre></div>
</div>
</div>
<p>Displacements</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[10]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Compute displacements</span>
<span class="n">disp</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">displacement</span><span class="p">(</span><span class="n">coords</span><span class="p">)</span>

<span class="c1"># Plot</span>
<span class="n">disp_max</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">disp</span><span class="o">.</span><span class="n">max</span><span class="p">())</span>
<span class="n">fig</span><span class="p">,</span> <span class="n">axes</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">16</span><span class="p">,</span><span class="mi">4</span><span class="p">),</span> <span class="n">ncols</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>

<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
    <span class="n">im</span> <span class="o">=</span> <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">pcolormesh</span><span class="p">(</span><span class="n">xvals</span><span class="p">,</span> <span class="n">yvals</span><span class="p">,</span> <span class="n">disp</span><span class="p">[:,</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">num_xy</span><span class="p">,</span> <span class="n">num_xy</span><span class="p">),</span> <span class="n">vmin</span><span class="o">=-</span><span class="n">disp_max</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="n">disp_max</span><span class="p">)</span>
    <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;$u_{{{i+1}}}$&#39;</span><span class="p">)</span>
    <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="n">xlabel</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s1">&#39;large&#39;</span><span class="p">)</span>
    <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="n">ylabel</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s1">&#39;large&#39;</span><span class="p">)</span>
    <span class="n">fig</span><span class="o">.</span><span class="n">colorbar</span><span class="p">(</span><span class="n">im</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Coordinates and displacements in Angstroms&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Coordinates and displacements in Angstroms
</pre></div></div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_24_1.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_24_1.png" />
</div>
</div>
<p>Stress</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[11]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Compute stress states</span>
<span class="n">stress</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">stress</span><span class="p">(</span><span class="n">coords</span><span class="p">),</span> <span class="s1">&#39;GPa&#39;</span><span class="p">)</span>

<span class="c1"># Plot</span>
<span class="n">stress_max</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">stress</span><span class="o">.</span><span class="n">max</span><span class="p">())</span> <span class="o">/</span> <span class="mi">10</span>
<span class="n">fig</span><span class="p">,</span> <span class="n">axes</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">16</span><span class="p">,</span><span class="mi">14</span><span class="p">),</span> <span class="n">ncols</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">nrows</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>

<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
    <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
        <span class="n">im</span> <span class="o">=</span> <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">]</span><span class="o">.</span><span class="n">pcolormesh</span><span class="p">(</span><span class="n">xvals</span><span class="p">,</span> <span class="n">yvals</span><span class="p">,</span> <span class="n">stress</span><span class="p">[:,</span> <span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">]</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">num_xy</span><span class="p">,</span> <span class="n">num_xy</span><span class="p">),</span> <span class="n">vmin</span><span class="o">=-</span><span class="n">stress_max</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="n">stress_max</span><span class="p">)</span>
        <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;$\sigma_{{{i+1}{j+1}}}$&#39;</span><span class="p">)</span>
        <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">]</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="n">xlabel</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s1">&#39;large&#39;</span><span class="p">)</span>
        <span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">]</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="n">ylabel</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s1">&#39;large&#39;</span><span class="p">)</span>
        <span class="n">fig</span><span class="o">.</span><span class="n">colorbar</span><span class="p">(</span><span class="n">im</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="n">axes</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">])</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Stress components in GPa, coordinates in Angstroms&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Stress components in GPa, coordinates in Angstroms
</pre></div></div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_26_1.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_26_1.png" />
</div>
</div>
</div>
</div>
</div>
<div class="section" id="4.-Dislocation-initialization">
<h2>4. Dislocation initialization<a class="headerlink" href="#4.-Dislocation-initialization" title="Permalink to this headline">¶</a></h2>
<p>The Dislocation class is initialized by giving it parameters associated with the crystal information and the dislocation definition.</p>
<p>Crystal parameters</p>
<ul class="simple">
<li><p><strong>ucell</strong> (<em>atomman.System</em>) The unit cell to use as the seed for generating the dislocation monopole system.</p></li>
<li><p><strong>C</strong> (<em>atomman.ElasticConstants</em>) The elastic constants associated with the bulk crystal structure for ucell.</p></li>
</ul>
<p>Dislocation parameters</p>
<ul class="simple">
<li><p><strong>burgers</strong> (<em>array-like object</em>) The dislocation’s Burgers vector given as a Miller or Miller-Bravais vector relative to ucell.</p></li>
<li><p><strong>ξ_uvw</strong> (<em>array-like object</em>) The dislocation’s line direction given as a Miller or Miller-Bravais vector relative to ucell.</p></li>
<li><p><strong>slip_hkl</strong> (<em>array-like object</em>) The dislocation’s slip plane given as a Miller or Miller-Bravais plane relative to ucell.</p></li>
<li><p><strong>m</strong> (<em>array-like object, optional</em>) The m unit vector for the dislocation solution. m, n, and ξ (dislocation line) should be right-hand orthogonal. Default value is [0,1,0] (y-axis).</p></li>
<li><p><strong>n</strong> (<em>array-like object, optional</em>) The n unit vector for the dislocation solution. m, n, and ξ (dislocation line) should be right-hand orthogonal. Default value is [0,0,1] (z-axis). n is normal to the dislocation slip plane.</p></li>
<li><p><strong>tol</strong> (<em>float</em>) A cutoff tolerance used with obtaining the dislocation solution. Only needs to be changed if there are issues with obtaining a solution.</p></li>
</ul>
<p>Shift parameters</p>
<ul class="simple">
<li><p><strong>shift</strong> (<em>float, optional</em>) A rigid body shift to apply to the rotated cell prior to inserting the dislocation. Should be selected such that the ideal slip plane does not correspond to any atomic planes. Is taken as absolute if shiftscale is False, or relative to the rotated cell’s box vectors if shiftscale is True. Cannot be given with shiftindex. If neither shift nor shiftindex is given then shiftindex = 0 is used.</p></li>
<li><p><strong>shiftindex</strong> (<em>float, optional</em>) The index of the identified optimum shifts based on the rotated cell to use. Different values allow for the selection of different atomic planes neighboring the slip plane. Note that shiftindex values only apply shifts normal to the slip plane; best shifts for non-planar dislocations (like bcc screw) may also need a shift in the slip plane. Cannot be given with shiftindex. If neither shift nor shiftindex is given then shiftindex = 0 is used.</p></li>
<li><p><strong>shiftscale</strong> (<em>bool, optional</em>) If False (default), a given shift value will be taken as absolute Cartesian. If True, a given shift will be taken relative to the rotated cell’s box vectors.</p></li>
</ul>
<div class="section" id="4.1.-Define-the-Dislocation">
<h3>4.1. Define the Dislocation<a class="headerlink" href="#4.1.-Define-the-Dislocation" title="Permalink to this headline">¶</a></h3>
<p>This is similar to what is done in Section #3 with the main differences being that the full unit cell is created rather than the box, and m and n are left as their default values. The default m=<span class="math notranslate nohighlight">\([0,1,0]\)</span> and n=<span class="math notranslate nohighlight">\([0,0,1]\)</span> values are left alone as this is the optimal choice for LAMMPS calculations and allows for the construction of any perfect straight dislocation type for any crystal structure.</p>
<p>Specify materials properties, namely the unit cell and the elastic constants.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[12]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Rough values for fcc Al</span>

<span class="n">ucell</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">&#39;prototype&#39;</span><span class="p">,</span> <span class="s1">&#39;A1--Cu--fcc&#39;</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="mf">4.05</span><span class="p">,</span> <span class="n">symbols</span><span class="o">=</span><span class="s1">&#39;Al&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ucell</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="n">C</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">ElasticConstants</span><span class="p">(</span><span class="n">C11</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mi">105</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">),</span>
                        <span class="n">C12</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mi">70</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">),</span>
                        <span class="n">C44</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mi">45</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Cij (GPa) =&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">C</span><span class="o">.</span><span class="n">Cij</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
avect =  [ 4.050,  0.000,  0.000]
bvect =  [ 0.000,  4.050,  0.000]
cvect =  [ 0.000,  0.000,  4.050]
origin = [ 0.000,  0.000,  0.000]
natoms = 4
natypes = 1
symbols = (&#39;Al&#39;,)
pbc = [ True  True  True]
per-atom properties = [&#39;atype&#39;, &#39;pos&#39;]
     id |   atype |  pos[0] |  pos[1] |  pos[2]
      0 |       1 |   0.000 |   0.000 |   0.000
      1 |       1 |   0.000 |   2.025 |   2.025
      2 |       1 |   2.025 |   0.000 |   2.025
      3 |       1 |   2.025 |   2.025 |   0.000

Cij (GPa) =
[[105.  70.  70.   0.   0.   0.]
 [ 70. 105.  70.   0.   0.   0.]
 [ 70.  70. 105.   0.   0.   0.]
 [  0.   0.   0.  45.   0.   0.]
 [  0.   0.   0.   0.  45.   0.]
 [  0.   0.   0.   0.   0.  45.]]
</pre></div></div>
</div>
<p>Define the dislocation</p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[13]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># FCC a/2&lt;101&gt;{111} dislocation</span>
<span class="n">burgers</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="o">-</span><span class="mf">0.5</span><span class="p">])</span>
<span class="n">slip_hkl</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">])</span>

<span class="c1"># Line direction determines dislocation character</span>
<span class="c1">#ξ_uvw = [ 1,-2, 1] # 90 degree edge</span>
<span class="c1">#ξ_uvw = [1, -1, 0] # 60 degree mixed</span>
<span class="n">ξ_uvw</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">]</span> <span class="c1"># 30 degree mixed</span>
<span class="c1">#ξ_uvw = [1, 0, -1] # 0 degree screw, i.e. parallel to burgers</span>
</pre></div>
</div>
</div>
<p>Initialize the Dislocation object using the above parameters</p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[14]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">disl</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">defect</span><span class="o">.</span><span class="n">Dislocation</span><span class="p">(</span><span class="n">ucell</span><span class="p">,</span> <span class="n">C</span><span class="p">,</span> <span class="n">burgers</span><span class="p">,</span> <span class="n">ξ_uvw</span><span class="p">,</span> <span class="n">slip_hkl</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="4.2.-Check-the-solution">
<h3>4.2. Check the solution<a class="headerlink" href="#4.2.-Check-the-solution" title="Permalink to this headline">¶</a></h3>
<p>The Dislocation object has a number of attributes that describe the basic setup.</p>
<ul class="simple">
<li><p><strong>transform</strong> is the Cartesian transformation matrix associated with rotating from the unit cell orientation to the rotated cell orientation. This can be used to transform any other vectors between the two orientations.</p></li>
<li><p><strong>uvws</strong> are the Miller vectors relative to the unit cell that are used for the rotated cell’s box vectors.</p></li>
<li><p><strong>ucell</strong> is the unit cell.</p></li>
<li><p><strong>rcell</strong> is the cell obtained after rotating ucell.</p></li>
<li><p><strong>dislsol</strong> is the VolterraDislocation solution that will be used to displace the atoms</p></li>
<li><p><strong>shifts</strong> provides a list of all “ideal” delta shift values that will position the slip plane halfway between two atomic planes. There is no guarantee that the planes are symmetrically unique and no shifting in the plane is accounted for either.</p></li>
<li><p><strong>shift</strong> is the shift value currently set. The default value is the first value in shifts.</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[15]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Transformation matrix =&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">disl</span><span class="o">.</span><span class="n">transform</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Rotation uvws =&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">disl</span><span class="o">.</span><span class="n">uvws</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Unit cell =&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">disl</span><span class="o">.</span><span class="n">ucell</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Rotated cell =&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">disl</span><span class="o">.</span><span class="n">rcell</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Transformation matrix =
[[ 0.40824829  0.40824829 -0.81649658]
 [-0.70710678  0.70710678  0.        ]
 [ 0.57735027  0.57735027  0.57735027]]

Rotation uvws =
[[ 1.  1. -2.]
 [-1.  1.  0.]
 [ 1.  1.  1.]]

Unit cell =
avect =  [ 4.050,  0.000,  0.000]
bvect =  [ 0.000,  4.050,  0.000]
cvect =  [ 0.000,  0.000,  4.050]
origin = [ 0.000,  0.000,  0.000]
natoms = 4
natypes = 1
symbols = (&#39;Al&#39;,)
pbc = [ True  True  True]
per-atom properties = [&#39;atype&#39;, &#39;pos&#39;]
     id |   atype |  pos[0] |  pos[1] |  pos[2]
      0 |       1 |   0.000 |   0.000 |   0.000
      1 |       1 |   0.000 |   2.025 |   2.025
      2 |       1 |   2.025 |   0.000 |   2.025
      3 |       1 |   2.025 |   2.025 |   0.000

Rotated cell =
avect =  [ 9.920,  0.000,  0.000]
bvect =  [ 0.000,  5.728,  0.000]
cvect =  [ 0.000,  0.000,  7.015]
origin = [ 0.000,  0.000,  0.000]
natoms = 24
natypes = 1
symbols = (&#39;Al&#39;,)
pbc = [ True  True  True]
per-atom properties = [&#39;atype&#39;, &#39;pos&#39;]
     id |   atype |  pos[0] |  pos[1] |  pos[2]
      0 |       1 |   7.440 |   4.296 |   0.000
      1 |       1 |   7.440 |   1.432 |   0.000
      2 |       1 |   9.094 |   1.432 |   2.338
      3 |       1 |   9.094 |   4.296 |   2.338
      4 |       1 |   2.480 |   1.432 |   0.000
      5 |       1 |   4.960 |   0.000 |   0.000
      6 |       1 |   2.480 |   4.296 |   0.000
      7 |       1 |   4.960 |   2.864 |   0.000
      8 |       1 |   4.134 |   4.296 |   2.338
      9 |       1 |   4.134 |   1.432 |   2.338
     10 |       1 |   6.614 |   2.864 |   2.338
     11 |       1 |   6.614 |   5.728 |   2.338
     12 |       1 |   5.787 |   1.432 |   4.677
     13 |       1 |   8.267 |   5.728 |   4.677
     14 |       1 |   5.787 |   4.296 |   4.677
     15 |       1 |   8.267 |   2.864 |   4.677
     16 |       1 |   9.920 |   2.864 |   0.000
     17 |       1 |   9.920 |   0.000 |   0.000
     18 |       1 |   1.653 |   0.000 |   2.338
     19 |       1 |   1.653 |   2.864 |   2.338
     20 |       1 |   0.827 |   4.296 |   4.677
     21 |       1 |   0.827 |   1.432 |   4.677
     22 |       1 |   3.307 |   2.864 |   4.677
     23 |       1 |   3.307 |   5.728 |   4.677

</pre></div></div>
</div>
<p>A Volterra dislocation solution is also obtained, which is accessible as the dislsol attribute</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[16]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;character angle = {disl.dislsol.characterangle()} degrees&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;K_coeff = {uc.get_in_units(disl.dislsol.K_coeff, &quot;GPa&quot;):.3f} GPa&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;burgers =&#39;</span><span class="p">,</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">disl</span><span class="o">.</span><span class="n">dislsol</span><span class="o">.</span><span class="n">burgers</span><span class="p">,</span> <span class="s2">&quot;angstrom&quot;</span><span class="p">),</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
character angle = 30.000000000000004 degrees
K_coeff = 33.399 GPa
burgers = [ 2.48010836 -1.43189123  0.        ] angstrom
</pre></div></div>
</div>
<p>The shift values should be selected such that the dislocation falls between atomic positions. For planar dislocations, the slip plane should be placed roughly halfway between atomic planes. The class automatically identifies all such shifts relative to rcell and stores them as the attribute shifts.</p>
<p>The initialization parameters allow for shifts to be defined in one of three ways:</p>
<ol class="arabic simple">
<li><p>Giving shiftindex indicates which of the identified shifts relative to rcell to use. If neither shift or shiftindex is specified, then shiftindex=0 is used.</p></li>
<li><p>Giving shift with shiftscale=False allows for an absolute Cartesian shift to be specified.</p></li>
<li><p>Giving shift with shiftscale=True allows for a shift relative to rcell’s box vectors to be specified.</p></li>
</ol>
<p>For non-planar screw dislocations, the dislocation core should be placed in the proper location where the involved slip planes intercept. This can be handled by specifying shifts using options 2 or 3.</p>
<p>Note that the shift can be changed when calling the monopole and periodicarray methods.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[17]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Identified shifts =&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">disl</span><span class="o">.</span><span class="n">shifts</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;The shift currently set to be used =&#39;</span><span class="p">,</span> <span class="n">disl</span><span class="o">.</span><span class="n">shift</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Identified shifts =
[[0.         0.         1.1691343 ]
 [0.         0.         3.50740289]
 [0.         0.         5.84567148]]

The shift currently set to be used = [0.        0.        1.1691343]
</pre></div></div>
</div>
</div>
</div>
<div class="section" id="5.-Dislocation-Monopole-Configuration">
<h2>5. Dislocation Monopole Configuration<a class="headerlink" href="#5.-Dislocation-Monopole-Configuration" title="Permalink to this headline">¶</a></h2>
<p>System size parameters</p>
<ul class="simple">
<li><p><strong>sizemults</strong> (<em>tuple, optional</em>) The size multipliers to use when generating the system. Values are limited to being positive integers. The multipliers for the two non-periodic directions must be even. If not given, the default multipliers will be 2 for the non-periodic directions and 1 for the periodic direction.</p></li>
<li><p><strong>amin</strong> (<em>float, optional</em>) A minimum thickness to use for the a box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both amin and sizemults is given, then the larger multiplier for the two will be used.</p></li>
<li><p><strong>bmin</strong> (<em>float, optional</em>) A minimum thickness to use for the b box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both bmin and sizemults is given, then the larger multiplier for the two will be used.</p></li>
<li><p><strong>cmin</strong> (<em>float, optional</em>) A minimum thickness to use for the c box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both cmin and sizemults is given, then the larger multiplier for the two will be used.</p></li>
</ul>
<p>Shift parameters</p>
<ul class="simple">
<li><p><strong>shift</strong> (<em>float, optional</em>) A rigid body shift to apply to the rotated cell prior to inserting the dislocation. Should be selected such that the ideal slip plane does not correspond to any atomic planes. Is taken as absolute if shiftscale is False, or relative to the rotated cell’s box vectors if shiftscale is True. Cannot be given with shiftindex. If neither shift nor shiftindex is given will use the shift set during class initialization.</p></li>
<li><p><strong>shiftindex</strong> (<em>float, optional</em>) The index of the identified optimum shifts based on the rotated cell to use. Different values allow for the selection of different atomic planes neighboring the slip plane. Note that shiftindex values only apply shifts normal to the slip plane; best shifts for non-planar dislocations (like bcc screw) may also need a shift in the slip plane. Cannot be given with shiftindex. If neither shift nor shiftindex is given then shiftindex = 0 is used then will use the
shift set during class initialization.</p></li>
<li><p><strong>shiftscale</strong> (<em>bool, optional</em>) If False (default), a given shift value will be taken as absolute Cartesian. If True, a given shift will be taken relative to the rotated cell’s box vectors.</p></li>
</ul>
<p>Boundary parameters</p>
<ul class="simple">
<li><p><strong>boundaryshape</strong> (<em>str, optional</em>) Indicates the shape of the boundary region to use. Options are ‘cylinder’ (default) and ‘box’. For ‘cylinder’, the non-boundary region is defined by a cylinder with axis along the dislocation line and a radius that ensures the boundary is at least boundarywidth thick. For ‘box’, the boundary region will be exactly boundarywidth thick all around.</p></li>
<li><p><strong>boundarywidth</strong> (<em>float, optional</em>) The width of the boundary region to apply. Default value is 0.0, i.e. no boundary region. All atoms in the boundary region will have their atype values changed.</p></li>
<li><p><strong>boundaryscale</strong> (<em>bool, optional</em>) If False (Default), the boundarywidth will be taken as absolute. If True, the boundarywidth will be taken relative to the magnitude of the unit cell’s a box vector.</p></li>
</ul>
<p>Return options</p>
<ul class="simple">
<li><p><strong>return_base_system</strong> (<em>bool, optional</em>) If True then the dislocation-free base system corresponding to the dislocation system will also be returned. The base system is used as a reference state for most of the dislocation analysis tools.</p></li>
</ul>
<div class="section" id="5.1.-Small-atomic-system-example,-easy-to-see-atomic-positions">
<h3>5.1. Small atomic system example, easy to see atomic positions<a class="headerlink" href="#5.1.-Small-atomic-system-example,-easy-to-see-atomic-positions" title="Permalink to this headline">¶</a></h3>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[18]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">base_system</span><span class="p">,</span> <span class="n">disl_system</span> <span class="o">=</span> <span class="n">disl</span><span class="o">.</span><span class="n">monopole</span><span class="p">(</span><span class="n">bmin</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> <span class="n">cmin</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span>
                                         <span class="n">boundarywidth</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">boundaryscale</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                         <span class="n">return_base_system</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[19]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span><span class="mi">6</span><span class="p">))</span>
<span class="k">for</span> <span class="n">atype</span> <span class="ow">in</span> <span class="n">disl_system</span><span class="o">.</span><span class="n">atypes</span><span class="p">:</span>
    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
             <span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="s1">&#39;o&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_45_0.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_45_0.png" />
</div>
</div>
</div>
<div class="section" id="5.2.-Large-atomic-system-example,-more-useful-for-simulations">
<h3>5.2. Large atomic system example, more useful for simulations<a class="headerlink" href="#5.2.-Large-atomic-system-example,-more-useful-for-simulations" title="Permalink to this headline">¶</a></h3>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[20]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">base_system</span><span class="p">,</span> <span class="n">disl_system</span> <span class="o">=</span> <span class="n">disl</span><span class="o">.</span><span class="n">monopole</span><span class="p">(</span><span class="n">bmin</span><span class="o">=</span><span class="mi">300</span><span class="p">,</span> <span class="n">cmin</span><span class="o">=</span><span class="mi">300</span><span class="p">,</span>
                                         <span class="n">boundarywidth</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">boundaryscale</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                         <span class="n">return_base_system</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[21]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span><span class="mi">6</span><span class="p">))</span>
<span class="k">for</span> <span class="n">atype</span> <span class="ow">in</span> <span class="n">disl_system</span><span class="o">.</span><span class="n">atypes</span><span class="p">:</span>
    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
             <span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="s1">&#39;o&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="o">-</span><span class="mi">160</span><span class="p">,</span> <span class="mi">160</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="o">-</span><span class="mi">160</span><span class="p">,</span> <span class="mi">160</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_48_0.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_48_0.png" />
</div>
</div>
</div>
<div class="section" id="5.3.-Dislocation-property-evaluations">
<h3>5.3. Dislocation property evaluations<a class="headerlink" href="#5.3.-Dislocation-property-evaluations" title="Permalink to this headline">¶</a></h3>
<p>The dislocation characterization methods all compare defect configurations to a defect-free base system. The monopole method automatically returns a compatible base system that can be used for the characterization methods.</p>
<p>See the <a class="reference external" href="4.6._Dislocation_analysis_tools.html">4.6. Dislocation analysis tools Notebook</a> for more dislocation property evaluations.</p>
<p><strong>NOTE</strong>: The characterizations shown here are simply for demonstration purposes. For real problems, the returned dislocation system should be atomically relaxed prior to characterizing it.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[22]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Plot disregistry</span>
<span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">defect</span><span class="o">.</span><span class="n">disregistry</span><span class="p">(</span><span class="n">base_system</span><span class="p">,</span> <span class="n">disl_system</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">n</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">])</span>

<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">8</span><span class="p">,</span><span class="mi">6</span><span class="p">))</span>

<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span><span class="p">[:,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="s1">&#39;x-disregistry&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span><span class="p">[:,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="s1">&#39;y-disregistry&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span><span class="p">[:,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="s1">&#39;z-disregistry&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>

<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;$</span><span class="se">\\</span><span class="s1">xi$-coordinate ($\AA$)&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="s1">&#39;x-large&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;disregistry ($\AA$)&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="s1">&#39;x-large&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">fontsize</span><span class="o">=</span><span class="s1">&#39;xx-large&#39;</span><span class="p">)</span>

<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_50_0.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_50_0.png" />
</div>
</div>
</div>
</div>
<div class="section" id="6.-Periodic-Array-of-Dislocations-Configuration">
<h2>6. Periodic Array of Dislocations Configuration<a class="headerlink" href="#6.-Periodic-Array-of-Dislocations-Configuration" title="Permalink to this headline">¶</a></h2>
<p>System size parameters</p>
<ul class="simple">
<li><p><strong>sizemults</strong> (<em>tuple, optional</em>) The size multipliers to use when generating the system. Values are limited to being positive integers. The multipliers for the two non-periodic directions must be even. If not given, the default multipliers will be 2 for the non-periodic directions and 1 for the periodic direction.</p></li>
<li><p><strong>amin</strong> (<em>float, optional</em>) A minimum thickness to use for the a box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both amin and sizemults is given, then the larger multiplier for the two will be used.</p></li>
<li><p><strong>bmin</strong> (<em>float, optional</em>) A minimum thickness to use for the b box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both bmin and sizemults is given, then the larger multiplier for the two will be used.</p></li>
<li><p><strong>cmin</strong> (<em>float, optional</em>) A minimum thickness to use for the c box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both cmin and sizemults is given, then the larger multiplier for the two will be used.</p></li>
</ul>
<p>Shift parameters</p>
<ul class="simple">
<li><p><strong>shift</strong> (<em>float, optional</em>) A rigid body shift to apply to the rotated cell prior to inserting the dislocation. Should be selected such that the ideal slip plane does not correspond to any atomic planes. Is taken as absolute if shiftscale is False, or relative to the rotated cell’s box vectors if shiftscale is True. Cannot be given with shiftindex. If neither shift nor shiftindex is given then shiftindex = 0 is used.</p></li>
<li><p><strong>shiftindex</strong> (<em>float, optional</em>) The index of the identified optimum shifts based on the rotated cell to use. Different values allow for the selection of different atomic planes neighboring the slip plane. Note that shiftindex values only apply shifts normal to the slip plane; best shifts for non-planar dislocations (like bcc screw) may also need a shift in the slip plane. Cannot be given with shiftindex. If neither shift nor shiftindex is given then shiftindex = 0 is used.</p></li>
<li><p><strong>shiftscale</strong> (<em>bool, optional</em>) If False (default), a given shift value will be taken as absolute Cartesian. If True, a given shift will be taken relative to the rotated cell’s box vectors.</p></li>
</ul>
<p>Boundary parameters</p>
<ul class="simple">
<li><p><strong>boundarywidth</strong> (<em>float, optional</em>) The width of the boundary region to apply. Default value is 0.0, i.e. no boundary region. All atoms in the boundary region will have their atype values changed and will be displaced by linear displacements.</p></li>
<li><p><strong>boundaryscale</strong> (<em>bool, optional</em>) If False (Default), the boundarywidth will be taken as absolute. If True, the boundarywidth will be taken relative to the magnitude of the unit cell’s a box vector.</p></li>
</ul>
<p>Method options</p>
<ul class="simple">
<li><p><strong>linear</strong> (<em>bool, optional</em>) If True, then only linear displacements will be used and not the dislocation solution. Using only linear displacements is useful for screw dislocations and dislocations with large stacking fault distances. If False (default) then the dislocation solution will be used for the middle displacements and linear displacements only in the boundary region.</p></li>
<li><p><strong>cutoff</strong> (<em>float, optional</em>) Cutoff distance to use for identifying duplicate atoms to remove. For dislocations with an edge component, applying the displacements creates an extra half-plane of atoms that will have (nearly) identical positions with other atoms after altering the boundary conditions. Default value is 0.5 Angstrom.</p></li>
</ul>
<p>Return options</p>
<ul class="simple">
<li><p><strong>return_base_system</strong> (<em>bool, optional</em>) If True then the dislocation-free base system corresponding to the dislocation system will also be returned. The base system is used as a reference state for most of the dislocation analysis tools.</p></li>
</ul>
<div class="section" id="6.1.-Small-atomic-system-example,-easy-to-see-atomic-positions">
<h3>6.1. Small atomic system example, easy to see atomic positions<a class="headerlink" href="#6.1.-Small-atomic-system-example,-easy-to-see-atomic-positions" title="Permalink to this headline">¶</a></h3>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[23]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">base_system</span><span class="p">,</span> <span class="n">disl_system</span> <span class="o">=</span> <span class="n">disl</span><span class="o">.</span><span class="n">periodicarray</span><span class="p">(</span><span class="n">bmin</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> <span class="n">cmin</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span>
                                              <span class="n">boundarywidth</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">boundaryscale</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                              <span class="n">return_base_system</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[24]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span><span class="mi">6</span><span class="p">))</span>
<span class="k">for</span> <span class="n">atype</span> <span class="ow">in</span> <span class="n">disl_system</span><span class="o">.</span><span class="n">atypes</span><span class="p">:</span>
    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
             <span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="s1">&#39;o&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_54_0.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_54_0.png" />
</div>
</div>
</div>
<div class="section" id="6.2.-Large-atomic-system-example,-more-useful-for-simulations">
<h3>6.2. Large atomic system example, more useful for simulations<a class="headerlink" href="#6.2.-Large-atomic-system-example,-more-useful-for-simulations" title="Permalink to this headline">¶</a></h3>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[25]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">base_system</span><span class="p">,</span> <span class="n">disl_system</span> <span class="o">=</span> <span class="n">disl</span><span class="o">.</span><span class="n">periodicarray</span><span class="p">(</span><span class="n">bmin</span><span class="o">=</span><span class="mi">300</span><span class="p">,</span> <span class="n">cmin</span><span class="o">=</span><span class="mi">300</span><span class="p">,</span>
                                              <span class="n">boundarywidth</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">boundaryscale</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                                              <span class="n">return_base_system</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[26]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span><span class="mi">6</span><span class="p">))</span>
<span class="k">for</span> <span class="n">atype</span> <span class="ow">in</span> <span class="n">disl_system</span><span class="o">.</span><span class="n">atypes</span><span class="p">:</span>
    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
             <span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">[</span><span class="n">disl_system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">atype</span><span class="o">==</span><span class="n">atype</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="s1">&#39;o&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="o">-</span><span class="mi">160</span><span class="p">,</span> <span class="mi">160</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="o">-</span><span class="mi">160</span><span class="p">,</span> <span class="mi">160</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_57_0.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_57_0.png" />
</div>
</div>
</div>
<div class="section" id="6.3.-Dislocation-property-evaluations">
<h3>6.3. Dislocation property evaluations<a class="headerlink" href="#6.3.-Dislocation-property-evaluations" title="Permalink to this headline">¶</a></h3>
<p>The dislocation characterization methods all compare defect configurations to a defect-free base system. The periodicarray method automatically returns a compatible base system that can be used for the characterization methods. This is especially important for PAD systems of dislocations with edge components as the deleted atoms are appropriately handled.</p>
<p>See the <a class="reference external" href="4.6._Dislocation_analysis_tools.html">4.6. Dislocation analysis tools Notebook</a> for more dislocation property evaluations.</p>
<p><strong>NOTE</strong>: The characterizations shown here are simply for demonstration purposes. For real problems, the returned dislocation system should be atomically relaxed prior to characterizing it.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[27]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Plot disregistry</span>
<span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">defect</span><span class="o">.</span><span class="n">disregistry</span><span class="p">(</span><span class="n">base_system</span><span class="p">,</span> <span class="n">disl_system</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">n</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">])</span>

<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">8</span><span class="p">,</span><span class="mi">6</span><span class="p">))</span>

<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span><span class="p">[:,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="s1">&#39;x-disregistry&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span><span class="p">[:,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="s1">&#39;y-disregistry&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xi</span><span class="p">,</span> <span class="n">disreg</span><span class="p">[:,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="s1">&#39;z-disregistry&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>

<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;$</span><span class="se">\\</span><span class="s1">xi$-coordinate ($\AA$)&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="s1">&#39;x-large&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;disregistry ($\AA$)&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="s1">&#39;x-large&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">fontsize</span><span class="o">=</span><span class="s1">&#39;xx-large&#39;</span><span class="p">)</span>

<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/tutorial_4.4._Dislocation_solution_and_generator_59_0.png" src="../_images/tutorial_4.4._Dislocation_solution_and_generator_59_0.png" />
</div>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Introduction to atomman: Dislocation solution and generator</a><ul>
<li><a class="reference internal" href="#1.-Introduction">1. Introduction</a></li>
<li><a class="reference internal" href="#2.-Theory">2. Theory</a><ul>
<li><a class="reference internal" href="#2.1.-Dislocation-solutions">2.1. Dislocation solutions</a><ul>
<li><a class="reference internal" href="#2.1.1.-Isotropic-solution">2.1.1. Isotropic solution</a></li>
<li><a class="reference internal" href="#2.1.2.-Anisotropic-solution">2.1.2. Anisotropic solution</a></li>
<li><a class="reference internal" href="#2.1.3.-Linear-displacement-solution">2.1.3. Linear displacement solution</a></li>
</ul>
</li>
<li><a class="reference internal" href="#2.2.-Dislocation-definition">2.2. Dislocation definition</a></li>
<li><a class="reference internal" href="#2.3.-Boundary-conditions">2.3. Boundary conditions</a><ul>
<li><a class="reference internal" href="#2.3.1.-Dislocation-monopoles">2.3.1. Dislocation monopoles</a></li>
<li><a class="reference internal" href="#2.3.2.-Periodic-array-of-dislocations">2.3.2. Periodic array of dislocations</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#3.-Volterra-solutions">3. Volterra solutions</a><ul>
<li><a class="reference internal" href="#3.1.-Build-solution">3.1. Build solution</a><ul>
<li><a class="reference internal" href="#3.2.-Compute-properties">3.2. Compute properties</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#4.-Dislocation-initialization">4. Dislocation initialization</a><ul>
<li><a class="reference internal" href="#4.1.-Define-the-Dislocation">4.1. Define the Dislocation</a></li>
<li><a class="reference internal" href="#4.2.-Check-the-solution">4.2. Check the solution</a></li>
</ul>
</li>
<li><a class="reference internal" href="#5.-Dislocation-Monopole-Configuration">5. Dislocation Monopole Configuration</a><ul>
<li><a class="reference internal" href="#5.1.-Small-atomic-system-example,-easy-to-see-atomic-positions">5.1. Small atomic system example, easy to see atomic positions</a></li>
<li><a class="reference internal" href="#5.2.-Large-atomic-system-example,-more-useful-for-simulations">5.2. Large atomic system example, more useful for simulations</a></li>
<li><a class="reference internal" href="#5.3.-Dislocation-property-evaluations">5.3. Dislocation property evaluations</a></li>
</ul>
</li>
<li><a class="reference internal" href="#6.-Periodic-Array-of-Dislocations-Configuration">6. Periodic Array of Dislocations Configuration</a><ul>
<li><a class="reference internal" href="#6.1.-Small-atomic-system-example,-easy-to-see-atomic-positions">6.1. Small atomic system example, easy to see atomic positions</a></li>
<li><a class="reference internal" href="#6.2.-Large-atomic-system-example,-more-useful-for-simulations">6.2. Large atomic system example, more useful for simulations</a></li>
<li><a class="reference internal" href="#6.3.-Dislocation-property-evaluations">6.3. Dislocation property evaluations</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="4.3._Stacking_fault_generator.html"
                        title="previous chapter">Introduction to atomman: Stacking fault generator</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="4.5._Gamma_surface_plotting.html"
                        title="next chapter">Introduction to atomman: Gamma surface plotting</a></p>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="4.5._Gamma_surface_plotting.html" title="Introduction to atomman: Gamma surface plotting"
             >next</a> |</li>
        <li class="right" >
          <a href="4.3._Stacking_fault_generator.html" title="Introduction to atomman: Stacking fault generator"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">atomman 1.4.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >Tutorials</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.0.
    </div>
  </body>
</html>